package com.peisong.controller.admin;

import com.jfinal.core.Controller;
import com.peisong.model.User;

/**
 * Created by Acey on 2016/10/31.
 */
public class IndexController extends Controller {
    public void index() {
        this.renderJsp("login.jsp");
    }

    /**
     * 跳转登录页面
     */
    public void toLogin() {
        this.renderJsp("login.jsp");
    }

    /**
     * 登录
     */
    public void login() {
        User user = this.getModel(User.class, "");
        user = User.dao.login(user);
        if(user != null) {
            this.setSessionAttr("userInfo",user);
            this.renderJsp("index.jsp");
        }else{
            this.setSessionAttr("info","账号或密码错误");
        }
    }


}

